﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Data;

public partial class Views_module_product : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string action = Request.QueryString["action"];
        if (!string.IsNullOrEmpty(action))
        {
            if (action == "category")
                getProductByCategoryID();
        }
        else
            getProducts();
    }
    public void getProducts()
    {
        listProducts.DataSource = null;
        listProducts.DataBind();
        productBus probus = new productBus();
        DataTable products = probus.getBestseller(12);
        listProducts.DataSource=products;
        listProducts.DataBind();
    }
    public void getProductByCategoryID()
    {
        listProducts.DataSource = null;
        listProducts.DataBind();
        productBus probus = new productBus();
        DataTable products = probus.getProductsByCatagory_id(Convert.ToInt32(Request.QueryString["id"]));
        listProducts.DataSource = products;
        listProducts.DataBind();
    }
}